/* More.h
Michael Zahniser, 2008

Header file for the More class, which displays a given string in a style similar
to the Unix "more" utility, using ncurses.
*/

#ifndef __MZ_MORE_H__
#define __MZ_MORE_H__

#include <string>

using std::string;



class More {
public:
	More(const string &text);
	
	void Run();
	
	
private:
	// Draw the portion of the text that is visible.
	void Draw() const;
	
	// Attempt to scroll the given iterator up or down. If it cannot be done
	// because the iterator is at the end of the text, return false.
	bool ScrollUp(string::const_iterator &it) const;
	bool ScrollDown(string::const_iterator &it) const;
	
	
private:
	const string &text;
	
	int columns;
	int rows;
	
	string::const_iterator first;
	string::const_iterator last;
};

#endif
